import java.util.Optional;

/**
 * @author LiuYan
 * @date 2023/5/8
 */
public class OptionalOptimization {
    public static void main(String[] args) {
        String str = null;
        // orElseThrow():Exception in thread "main" java.util.NoSuchElementException: No value present
        String newStr= Optional.ofNullable(str).orElseThrow();
        System.out.println(newStr);
    }
}
